home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_09_02
/
9n02099a
< prev
next >
Wrap
Text File
|
1990-12-12
|
812b
|
27 lines
void main(void)
{
char b[32]; // Buffer for user input
int size; // Symbol size
int i; // Loop counter
union // Space for test symbol
{
SYMBOL x;
char y[sizeof(SYMBOL)+255];
} sym;
memset(&sym,0,sizeof(sym)); // Clear symbol area
printf("Symbol size? "); // Get symbol size from user
gets(b);
size = atoi(b);
if(size < 0) size = 0; // Make sure size is in bounds
if(size > 255) size = 255;
memset(sym.x.symbol,'X',size); // Set symbol to X's
for(i = 0; savesym(&sym.x) != NULL; i++); // Allocate all memory
printf("\n%d symbols allocated\n",i); // Print number of symbols
}